package cheme.ProcessModel.Cmds;

import org.eclipse.draw2d.geometry.Point;

import cheme.ProcessModel.IBoundedTranslatable;

public class OrphanTranslatableChildCmd extends OrphanChildCmd
{
	private Point oldLocation;

	public OrphanTranslatableChildCmd(IBoundedTranslatable child)
	{
		super(child);
	}

	public void execute()
	{
		preExecute();
		
		oldLocation = ((IBoundedTranslatable)child).getBounds().getLocation();
		
		parent.remove(child);
	}

	public void redo()
	{
		parent.remove(child);
	}

	public void undo()
	{
		((IBoundedTranslatable)child).getBounds().setLocation(oldLocation);
		parent.add(child, index);
	}
}